<script setup>

const props = defineProps({
    list:Array,
    value:Array
})
const onClick = (item)=>{
    props.value.includes(item.value)?props.value.splice(props.value.indexOf(item.value),1):props.value.push(item.value)
}
</script>

<template>
    <div class="select-container">
        <div :class="['card',value.includes(item.value)?'card-active':'']" v-for="item,index in list" @click="onClick(item)">
            {{item.text}}
        </div>
    </div>
</template>

<style scoped>
.select-container{
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding-bottom: 10px;
}
.card{
    padding: 5px 15px;
    background-color: rgb(243, 243, 243);
    border-radius: 4px;
    margin: 10px 0 0px 0;
    margin-right: 5px;
    transition: all 0.3s;
}
.card-active{
    background-color: var(--light-color);
    color: white;
}
</style>